home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #11
/
Amiga Plus CD - 2004 - No. 11.iso
/
AmiSoft
/
Comm
/
yam
/
kmailtombox.lha
/
kmailtombox
Wrap
Text File
|
2004-06-22
|
2KB
|
75 lines
/* Kmail to MBOX Arexx Script V1.0
Specify path of Kmail's messages (blank assumes current) (Don't put the trailing /)
a file called MBOX will be placed in the directory where this is run from
It will process all files in that directory as if they were messages (so remove files that aren't)
Written by: Arthur D. Moyer (lordart@lbpsinc.com)
Disclaimer: Worked for me for what I was using it for, and YAM didn't seem to have an issue!
Hopefully it will do the same for you! :)
*/
parse arg mpath
address command
'list >t:mbox quick sort name 'mpath
i=1
if exists('t:mbox') then DO
l=open(mlist,'t:mbox','R')
if ((right(mpath,1)~=':') & (right(mpath,1)~="/")) THEN mpath=mpath||'/'
l=open(mbox,'mbox','W')
DO FOREVER
ln=readln(mlist)
if (index(ln,' blocks used')>0) then break
say '#'i' filename being processed: 'ln
i=i+1
l=open(mfile,mpath||ln,'R')
finfo=''
dinfo=''
DO WHILE EOF(mfile)=0
mln=readln(mfile)
if (index(mln,'From:')>0) THEN finfo=mln
if (index(mln,'Date:')>0) THEN dinfo=mln
if (finfo~='') & (dinfo~='') THEN break
END
/*say finfo' 'dinfo*/
if ((index(finfo,'<')>0) & (index(finfo,'>')>0)) THEN DO
s=index(finfo,'<')
e=index(finfo,'>')
parse var finfo '<' fout '>' fr
END
else DO
parse var finfo 'From: ' fout
END
if (index(dinfo,',')=0) THEN DO
parse var dinfo dhd dcal dmon dyear dtime dzone
dday='Sat'
END
else DO
parse var dinfo dhd dday dcal dmon dyear dtime dzone
parse var dday dday ','
END
/*say dday' 'dcal' 'dmon' 'dyear' 'dtime' 'dzone*/
dout=dday' 'dmon' 'right(' 'dcal,2)' 'dtime' 'dyear
/*say dout' 'length(dout)*/
l=seek(mfile,0,'B')
l=writeln(mbox,'From 'fout' 'dout)
do while (EOF(mfile)=0)
mln=readln(mfile)
if (left(mln,5)='From ') THEN mln='>'mln
l=writeln(mbox,mln)
end
l=writeln(mbox,'')
l=close(mfile)
END
l=close(mlist)
l=close(mbox)
say''
say'MBox processing completed. Mbox File Created.'
END
'delete >nil: t:mbox'